package com.goddess.yeecolor.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.goddess.yeecolor.R;
import com.goddess.yeecolor.base.BaseActivity;
import com.goddess.yeecolor.tools.CookieUtils;
import com.goddess.yeecolor.tools.JumpIntents;
import com.goddess.yeecolor.tools.SharePreceUtils;

/**
 * 设置
 */
public class setActivity extends BaseActivity implements View.OnClickListener{
    private Bundle bundle;
    private TextView set_MyDetails,set_chagePassword;
    private Button set_backLogin;
    private View mView;
    private TextView mTitle;
    private Toolbar mToobar;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        setTheme(R.style.AppTheme);
        super.onCreate(savedInstanceState);
        mView= LayoutInflater.from(this).inflate(R.layout.activity_set,null);
        setContentView(mView);
        initFindView();
        initOnClck();
    }

    @Override
    public void initOnClck() {
        set_backLogin.setOnClickListener(this);
        set_MyDetails.setOnClickListener(this);
        set_chagePassword.setOnClickListener(this);
    }

    @Override
    public void initFindView() {
        mToobar= (Toolbar) findViewById(R.id.title_toobar);
        mTitle= (TextView) findViewById(R.id.title_content);
        mTitle.setText("设置");
//        setSupportActionBar(mToobar);
//        getSupportActionBar().setDisplayShowTitleEnabled(false);
        mToobar.setNavigationIcon(R.mipmap.back3x);
        mToobar.setNavigationOnClickListener((view)->{
            setFiish(this);
        });

        set_MyDetails= (TextView) findViewById(R.id.set_MyDetails);
        set_chagePassword= (TextView) findViewById(R.id.set_chagePassword);
        set_backLogin= (Button) findViewById(R.id.set_backLogin);
    }

    @Override
    public void initData() {

    }

    @Override
    public void onClick(View view) {

        int id=view.getId();
        switch (id){
            case R.id.set_MyDetails://个人资料
                JumpIntents.startIntentCan(setActivity.this,PerfectMeansAcitivity.class,"设置个人资料");
                break;
            case R.id.set_chagePassword://修改密码
                JumpIntents.startIntent(setActivity.this,ChagePassWordAcitivity.class);
                break;
            case R.id.set_backLogin://退出登录
                SharePreceUtils.clearData("user");
                SharePreceUtils.saveOne("type",1,"show");
                CookieUtils.getInstence().removeCookie();
                JumpIntents.startIntent(setActivity.this,MainActivity.class);
                finish();
                break;

        }
    }
}
